#include <stdio.h>
#include <stdbool.h>
#include <string.h>

bool canConstruct(char* ransomNote, char* magazine) 
{
    int len1 = strlen(ransomNote);
    int len2 = strlen(magazine);
    if(len1 > len2)
    {
        return false;
    }
    int start = 0;
    int end = 0;

        for(int j = 0;j < len2;j++)
        {
            int s = j;
            while(ransomNote[start] == magazine[j] && ransomNote[start] != '\0')
            {
                start++;
                j++;
                end++;
            }
            if(end == len1)
            {
                return true;
            }else
            {
                start = 0;
                end = 0;
                j = s;
            }
        

    }
    return false;

}

int main()
{
    char ransomNote[] = "aa";
    char magazine[] = "bbabaa";

    int a = canConstruct(ransomNote,magazine);
    printf("%d\n",a);
    return 0;
}